using System;
using System.Text.RegularExpressions;

namespace HCP
{
	public static class ElementId
	{
		public static string ObjectPart(string id)
		{
			GroupCollection groups = Regex.Match(id, "([^:]+)").Groups;
			return (groups.Count <= 1) ? null : groups[1].Value;
		}

		public static string ComponentPart(string id)
		{
			GroupCollection groups = Regex.Match(id, ".*:([^\\[]+)").Groups;
			return (groups.Count <= 1 || string.IsNullOrEmpty(groups[1].Value)) ? ((!ElementId.HasComponentPart(id)) ? "Transform" : ElementId.ObjectPart(id)) : groups[1].Value;
		}

		public static bool IsSticky(string id)
		{
			return id.Contains("-");
		}

		public static bool HasComponentPart(string id)
		{
			return id.Contains(":");
		}
	}
}
